<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="cmcc.operator.*"%>
<%@include file="../checkLoginSession.jsp"%>

<%
	String flag = request.getParameter("flag");
	if (flag == null || !flag.equals("change")) {
%>
<script type="text/javascript">
	history.back();
</script>
<%
	return;
	}
	String operator_id = request.getParameter("operator_id");
	String operator_name = request.getParameter("operator_name");
	String operator_pwd1 = request.getParameter("operator_pwd1");
	String operator_pwd2 = request.getParameter("operator_pwd2");
	String is_admin = request.getParameter("is_admin");
	System.out.println("saveChange.jsp-----------------");
	System.out.println("\t id=" + operator_id);
	System.out.println("\t pwd=" + operator_pwd1);
	System.out.println("\t pwd=" + operator_pwd2);
	System.out.println("\t name=" + operator_name);
	System.out.println("\t is_admin=" + is_admin);
	System.out.print("----------------------------");
	Operator o = Operator.getOperatorById(operator_id);
	if (operator_pwd1 != null && operator_pwd2 != null
			&& operator_name != null && is_admin != null
			&& operator_pwd1.equals(operator_pwd2)
			&& operator_id.length() >= 4) {
	
		if(o.updateChange(operator_name, operator_pwd1, is_admin)){
			%>
				<br/><br/><br/><br/>
				<h2 align="center">
					<font color="red">修改成功</font>
				</h2>
				<br/><br/>
				<h3 align="center">
					<a href="operatorList.jsp">返回</a>					
				</h3>
			<%	
		}else{
			%>
				<br/><br/><br/><br/>
				<h2 align="center">
					<font color="red">修改失败，请稍后再试</font>
				</h2>
				<br/><br/>
				<h3 align="center">
					<a href="operatorList.jsp">返回</a>					
				</h3>
			<%
		}	
	}else{
		%>
			<br/><br/><br/><br/>
			<h2 align="center">
				<font color="red">修改失败，信息填写错误，请重试</font>
			</h2>
			<br/><br/>
			<h3 align="center">
				<a href="operatorList.jsp">返回</a>					
			</h3>
		<%
	}
	
%>

